<template>
	<view class="wrap">
		<view class="img">
			<ikun-qrcode
			    width="300"
			    height="300"
			    unit="rpx"
			    color="#000000"
			    :data="Info.order_num" 
			/>
		</view>
		<view class="content" v-if="type == 1">
			<text>{{Info.start_time_text.substr(0, 10)}}（{{getWeekday(Info.start_time_text.substr(0, 10))}}）</text>
			<text>{{Info.number}}号场：{{Info.start_time_text.substr(11)}}-{{Info.end_time_text.substr(11)}}</text>
		</view>
		<view class="content" v-if="type == 2">
			<text>{{Info.end_time_text.substr(0, 10)}}（{{getWeekday(Info.end_time_text.substr(0, 10))}}）</text>
			<text>到期时间：{{Info.end_time_text}}</text>
		</view>
	</view>
</template>

<script setup>
import {onLoad} from '@dcloudio/uni-app'
import { ref } from 'vue';
import request from '../../utils/request';

let qrCodeBase64 = ref('')
onLoad((options)=>{
	token.value=uni.getStorageSync('token')
	console.log(options)
	Info.value = JSON.parse(options.info)
	type.value = options.type
	// request.post('Order/makeQrcode',{data:{
	// 	order_num:order_num.value
	// },header:{
	// 	"token":token.value
	// }}).then(res=>{
	// 	console.log(res);
	// 	image.value=res.data
	// }).catch(err=>{
	// 	console.log(err);
	// })
})
let order_num=ref()
let token=ref('')
let Info=ref({})
let type = ref('')

const getWeekday = (dateString) => {
  const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  const date = new Date(dateString);
  const weekdayIndex = date.getDay();
  return days[weekdayIndex];
}
</script>

<style scoped lang="scss">
	
	
	.wrap {
		padding: 24rpx;
		box-sizing: border-box;
		
		.img {
			display: flex;
			align-items: center;
			justify-content: center;
			margin-bottom: 20rpx;
		}
		
		.content {
			display: flex;
			flex-direction: column;
			align-items: center;
			
			text {
				display: block;
				font-size: 28rpx;
				margin-bottom: 24rpx;
			}
		}
	}
	.ewm{
		width: 500rpx;
		height: 500rpx;
		display: block;
		margin: 0 auto;
	}
</style>
